<include file="public@header"/>
</head>
<body>
    <div class="layui-fluid js-check-wrap">
        <ul class="nav nav-tabs">
            <li><a href="{:url('AdminBranchRegion/index')}">{:lang('PORTAL_ADMINBRANCHREGION_INDEX')}</a></li>
            <li><a href="{:url('AdminBranchRegion/add',array('term'=>empty($term['term_id'])?'':$term['term_id']))}" target="_self">{:lang('PORTAL_ADMINBRANCHREGION_ADD')}</a></li>
            <li class="active"><a href="#">{:lang('PORTAL_ADMINBRANCHREGION_EDIT')}</a></li>
        </ul>

        <div class="row margin-top-20">
            <div class="col-md-2">
                <div class="list-group">
                    <a class="list-group-item on" href="#A" data-toggle="tab">基本属性</a>
                </div>
            </div>
            <div class="col-md-6">
                <form class="js-ajax-form" action="{:url('AdminBranchRegion/editPost')}" method="post">
                    <div class="tab-content">
                        <div class="tab-pane active" id="A">
                            <div class="layui-form-item">
                                <label class="control-label"><span class="form-required">*</span>{:lang('NAME')}</label>
                                <div>
                                    <input type="text" name="b_name" class="layui-input" required value="{$data.b_name}" placeholder="请输入{:lang('NAME')}"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label for="input-description">{:lang('REGION_MAP_PIC')}（推荐尺寸 1400px * 665px）</label>
                                <div class="upload-image">
                                    <input type="hidden" name="b_thumb" id="thumbnail"
                                           value="{$data.b_thumb|default=''}">
                                    <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
                                        <if condition="empty($data.b_thumb)">
                                            <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                                 id="thumbnail-preview"
                                                 width="135" style="cursor: pointer"/>
                                            <else/>
                                            <img src="{:cmf_get_image_preview_url($data.b_thumb)}"
                                                 id="thumbnail-preview"
                                                 width="135" style="cursor: pointer"/>
                                        </if>
                                    </a>
                                    <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label>内容</label>
                                <div>
                                    <script type="text/plain" id="content" name="content">{$data.content}</script>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-col-smoffset-2 layui-col-sm10">
                            <input type="hidden" name="b_r_id" value="{$data.b_r_id}">
                            <button type="submit" class="layui-btn layui-btn-normal js-ajax-submit">{:lang('SAVE')}</button>
                            <a class="btn btn-default" href="{:url('AdminBranchRegion/index')}">{:lang('BACK')}</a>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        
    </div>
    <script type="text/javascript" src="__STATIC__/js/admin.js"></script>
    <script type="text/javascript">
        //编辑器路径定义
        var editorURL = GV.WEB_ROOT;
    </script>
    <script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.js"></script>
</body>
</html>
<script type="text/javascript">
    $(function () {
        if( $('#content').length ){
            editorcontent = new baidu.editor.ui.Editor();
            editorcontent.render('content');
            try {
                editorcontent.sync();
            } catch (err) {
            }
        }

        //移除缩略图
        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });

    });
</script>
